<?php
class MainController extends AppController {

	var $name = 'Main';
	var $components = array('Email');
	var $uses = null;
	function beforeFilter() {
		parent::beforeFilter(); 
		/*$this->Auth->deny('index', 'clearcache');*/

	}
	
	function admin_index() {
		//$this->Session->setFlash(__('Application wide controller', true));
	}
	function admin_clearcache() {
		//$file = ClassRegistry::init('File');
		//$userInstance = ClassRegistry::init('User');
		//debug($file);
		//debug(Cache::clear(true));
		if(clearCache()) {
			$this->Session->setFlash(__('CakePHPs Cache is cleared!', true));
		} else {
			$this->Session->setFlash(__('CakePHPs Cache was not cleared!', true));
		}
		
		$this->redirect(array('action'=>'index'));
	}
	function admin_simplemail($to, $subject, $body) {
		$mail_settings = Configure::read('Mail');
		$this->Email->from    = $mail_settings['from_name'] . ' <' . $mail_settings['from_mail'] . '>';
		$this->Email->to      = $to;
		$this->Email->subject = $subject;
		debug($this->Email);
		//$this->Email->send($body);
		
	}
}